package com.sxt.system.common;

import org.apache.shiro.authz.UnauthorizedException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

import java.util.HashMap;
import java.util.Map;

/**
 * @ClassName 全局异常处理
 * @Description TODO
 * @Author 雷哥
 * @Date 2020/2/16 14:32
 */
@RestControllerAdvice
public class ExceptionAutoConfig {


    @ExceptionHandler(UnauthorizedException.class)
    public Map<String,Object> unAuthorized(){
        Map<String,Object> map=new HashMap<>();
        map.put("code",302);
        map.put("msg","没有调用权限");
        return map;
    }

}
